import { HttpService, Injectable } from "@nestjs/common";
import { Request, Response } from "express";
import { Observable } from "rxjs";
import { Cat } from "../interfaces/Cat";
import {AxiosResponse} from "axios";

@Injectable()
export class ProxyService {

  constructor(private readonly httpService: HttpService) {}
  proxyAll(request:Request):Observable<AxiosResponse<any>>{
    return this.httpService.request({
      url:"http://192.168.10.67:8095" + request.url,
      method:"get"
    });
  }
  /**
   * 查找所有的接口，并且代理转发
   */
  findAll():Observable<AxiosResponse<Cat[]>>{
    return this.httpService.get("http://192.168.10.163:3000/mock/557/12/formData");
  }
}
